          
          
          //导航栏是否展开
          var flip = false;
          //导航栏所否变为水平
          var horizontal = false;
          //当前被点击的可伸展子导航的索引
          var now = 0;
          //子导航是否伸展
          var drop = false;
          
          var navSideWidth = null;
          var navChanging = false;
          var mobileDevice = false;
          var linkJumpCount = 3;
          var linkHref;
          var beginningDelay = 0;
          var animateDelayCount = 0;
          function countDown(){
                linkJumpCount -= 1;
                console.log(linkJumpCount);
                //linkJumpCount=0时，跳转页面
                if(linkJumpCount <= 0){
                    location.href = linkHref;
                }

                //每秒执行一次,showTime()
                setTimeout("countDown()",1000);
            }
            
            var originalHorizontal = window.innerWidth <= 1250?true:false;
            function changeBtn(index){
                console.log(index);
                if(index == now){
                    drop = !drop;
                    if(drop){
                        $('.sonMenu').parent()[now].parentNode.style.background = '#1a1a1a';
                    }else{
                        setTimeout(function(){
                            $('.sonMenu').parent()[now].parentNode.style.background = '';
                        },500);
                    }
                    $('.sonMenu').siblings('i')[now].style.transform = drop?'scaleX(1)':'scaleX(0)';
                    $('.sonMenu').siblings('p')[now].children[0].style.opacity = drop?'0':'1';
                    $('.sonMenu').siblings('p')[now].children[1].style.opacity = drop?'1':'0';    
                    $('.sonMenu')[now].style.height = drop?($('.sonMenu')[now].children[0].offsetHeight + 'px'):'0px';
                    console.log(horizontal);
                    if(!horizontal) return false;
                   /* $('header .navSide')[0].style.height = drop?
                    (70 + $('header .navSide nav')[0].offsetHeight + $('.sonMenu')[now].children[0].offsetHeight + 'px'):
                    (70 + $('header .navSide nav')[0].offsetHeight - $('.sonMenu')[now].children[0].offsetHeight + 'px');*/
                    
                }else{
                    if(drop){
                        $('.sonMenu').siblings('i')[now].style.transform = 'scaleX(0)';
                        $('.sonMenu').siblings('p')[now].children[0].style.opacity = '1';
                        $('.sonMenu').siblings('p')[now].children[1].style.opacity = '0';  
                        $('.sonMenu')[now].style.height = '0px';
                        var temp = now;
                        setTimeout(function(){
                            $('.sonMenu').parent()[temp].parentNode.style.background = '';
                        },500);
                    }
                    if(index == undefined){
                        /*if(drop && horizontal){
                            $('header .navSide')[0].style.height = (70 + $('header .navSide nav')[0].offsetHeight - $('.sonMenu')[now].children[0].offsetHeight + 'px')
                        }*/
                        drop = false;
                        return false;
                    }
                    drop = true;
                    $('.sonMenu').parent()[index].parentNode.style.background = '#1a1a1a';
                    $('.sonMenu').siblings('i')[index].style.transform = drop?'scaleX(1)':'scaleX(0)';
                    $('.sonMenu').siblings('p')[index].children[0].style.opacity = drop?'0':'1';
                    $('.sonMenu').siblings('p')[index].children[1].style.opacity = drop?'1':'0';    
                    $('.sonMenu')[index].style.height = ($('.sonMenu')[index].children[0].offsetHeight + 'px');
                    //horizontal && ($('header .navSide')[0].style.height = (70 + $('header .navSide nav')[0].offsetHeight + $('.sonMenu')[index].children[0].offsetHeight + 'px'));
                    now = index;
                    
                }
                
            }
            function changeBtnTip(){
                if($('header .navSide')[0].className.indexOf('menu') >= 0){
                    $('header .navSide').removeClass('menu');
                    $('header .navSide').addClass('back');
                }else{
                    $('header .navSide').removeClass('back');
                    $('header .navSide').addClass('menu');
                }
            }
            //判断是否为移动设备
            function browserRedirect() {
                var sUserAgent = navigator.userAgent.toLowerCase();
                var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
                var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
                var bIsMidp = sUserAgent.match(/midp/i) == "midp";
                var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
                var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
                var bIsAndroid = sUserAgent.match(/android/i) == "android";
                var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
                var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
                if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM) {
                    $('body').addClass('mobileDevice');
                    mobileDevice = true;
                }
            }
            $(document).ready(function(){
                console.log(window.history.length);
                browserRedirect();
                if(window.history.length == 1 || window.performance.navigation.type == 1){
                    setTimeout(function(){
                        $('body').css('overflow-y','auto');
                    },2000);
                    $('.beginning').addClass('first');
                }else{
                    
                    $('.beginning').addClass('basic');
                    $('.beginning').addClass('enter');
                    setTimeout(function(){
                        $('body').css('overflow-y','auto');
                    },990);
                }
                
                
               $('a').click(function(e){
                   linkHref = this.href;
                    e = e || window.event;
                    if(e.preventDefault){ // w3c
                        
                        $('.beginning').addClass('leave');
                        setTimeout(function(){
                            $('body').css('overflow-y','hidden');
                        },990);
                        countDown();
                        e.preventDefault();
                    } else { // ie
                        
                        $('.beginning').removeClass('leave');
                        setTimeout(function(){
                            $('body').css('overflow-y','hidden');
                        },990);
                        countDown(this.href);
                        e.returnValue = false;
                    }
               })
                $('header .navSide .navBtn>*').click(function(){
                    flip = !flip;
                    changeBtnTip();
                    console.log(horizontal);
                    if(horizontal){
                        $('header .navSide')[0].style.height = flip?
                        (70 + $('header .navSide nav')[0].offsetHeight + 'px'):'70px';
                    }else{
                        var navSideWidth = window.innerWidth > 1350?80:50;
                        var actualWidth = 300;
                        $('header .navSide')[0].style.width = flip?actualWidth:navSideWidth;
                        if(drop){
                            changeBtn(now);
                        }
                    }
                    
                })
                
                for(var c = 0;c < $('.sonMenu').length;c++){
                    $('.sonMenu').parent()[c].ind = c;
                    console.log($('.sonMenu').parent()[c].ind);
                }
                
                $('header .navSide nav ul .col').click(function(){
                    $('header .navSide nav ul .col').parent().removeClass('active');
                    $(this).parent().addClass('active');
                    changeBtn($(this)[0].ind);
                })
                $('.sonMenu li').click(function(){
                    $('.sonMenu li').removeClass('active');
                    $(this).addClass('active');
                })

                navSideWidth = setInterval(function(){
                    if(originalHorizontal){
                        originalHorizontal = null;
                        horizontal = true;
                        $('header .navSide').css({'height':'70px','width':'100%','opacity':'1','transition':'all ease .5s'});
                        $('.container').css('margin-top','70px');
                        $('header .navSide nav').addClass('complete');
                        $('.container').removeClass('horizontal');
                        return false;
                    }else{
                        if(originalHorizontal != null){
                            originalHorizontal = null;
                            $('.container').removeClass('horizontal');
                            return false;
                        }
                    }
                    var navSide_Width = window.innerWidth > 1350?80:50;
                    var actualWidth = 300;
                    if(window.innerWidth <= 1250){
                        if(horizontal) return false;
                        horizontal = true;
                        navChanging = true;
                        console.log('1250');
                        
                        $('header .navSide').css({'transform':'translate(-100%,0%)','opacity':'0'});
                        $('header .navSide')[0].step1 = setTimeout(function(){
                            $('header .navSide nav').addClass('complete');
                            $('header .navSide').css({'height':'70px','width':'100%','transform':'translate(0%,-100%)','transition':'all ease 0s'});
                            drop && changeBtn(now);
                        },500)
                        $('header .navSide')[0].step3 = setTimeout(function(){
                            $('header .navSide').css({'transform':'translate(0%,0%)','opacity':'1','transition':'all ease .5s'});
                            $('.container').css('margin-top','70px');
                            navChanging = false;
                        },1000)
                        if(flip){
                            changeBtnTip();
                        }
                        flip = false;
                    }else{
                        $('header .navSide nav .contn .box .middle').width(actualWidth + 17 + 'px');
                        if(horizontal){
                            horizontal = false;
                            console.log('>= 1250')
                            navChanging = true;
                            
                            $('header .navSide').css({'transform':'translate(0%,-100%)','opacity':'0'});
                            $('.container').css('margin-top','0px');
                            
                            $('header .navSide')[0].step1 = setTimeout(function(){
                                $('header .navSide nav').removeClass('complete');
                                $('header .navSide').css({'transform':'translate(-100%,0%)','height':'100%','width':'50px'});
                                drop && changeBtn(now);
                            },500);
                            $('header .navSide')[0].step3 = setTimeout(function(){
                                $('header .navSide').css({'transform':'translate(0%,0%)','opacity':'1'});
                                navChanging = false;
                            },1000)
                            if(flip){
                                changeBtnTip();
                            }
                            flip = false;
                        }
                        if(navChanging) return false;
                        if(flip){
                            if($('header .navSide')[0].offsetWidth == actualWidth) return false;
                            $('header .navSide').css('width',actualWidth + 'px');
                        }else{
                            
                            if($('header .navSide')[0].offsetWidth == navSide_Width) return false;
                            $('header .navSide').css('width',navSide_Width + 'px');
                        }
                    }
                    
                },10);
            })

            

        